<template>
  <div class="student">
    <h1>学生姓名：{{name}}</h1>
    <h1>学生性别：{{sex}}</h1>
    <button @click="sendStudentName">点我将学生名字传递给App</button>
  </div>
</template>

<script>
    export default {
        name: "Student",
        data(){
          return{
            name:'李四',
            sex:'女'
          }
        },
      methods:{
        sendStudentName(){
          //触发Student组件实例对象身上的showN事件
          this.$emit('showN',this.name)
        }
      }
    }
</script>

<style scoped>
.student{
  background-color: pink;
}
</style>
